<template>
	<view>
		<view class="categoryList">
			<navigator :url="`/pages/imgCategory/imgCategory?id=${item.id}`" class="category_item" v-for="(item,i) in categoryList" :key="i">
				<image :src="item.cover" mode="aspectFix"></image>
				<view class="cate_name">
					<text>
						{{item.name}}
					</text>
				</view>
			</navigator>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				categoryList: []
			}
		},
		mounted() {
			this.getDateList()
		},
		methods: {
			async getDateList(){
				const res = await this.request({url: 'http://157.122.54.189:9088/image/v1/vertical/category'})
				console.log(res)
				this.categoryList  = res.data.res.category
			}
			
		}
	}
</script>

<style lang="scss" scoped>
.categoryList {
	display: flex;
	flex-wrap: wrap;
	.category_item {
		width: 32.7%;
		border: 2rpx solid #FFFDEF;
		position: relative;
		image {
			height: 200rpx;
		}
		.cate_name {
			position: absolute;
			bottom: 0;
			left: 0;
			color: #FFFDEF;
			font-size: 34rpx;
			width: 100%;
			height: 50rpx;
			background-image: linear-gradient(to right top,rgba(0,0,0,2),rgba(0,0,0,0));
			overflow: hidden;
			text {
				padding: 5rpx 20rpx;
			}
		}
	}
}
</style>
